package cn.kn.triage.sys.service.impl;

import cn.kn.triage.common.model.R;
import cn.kn.triage.common.servic.BaseService;
import cn.kn.triage.sys.mapper.LogMapper;
import cn.kn.triage.sys.model.Log;
import cn.kn.triage.sys.model.LogExample;
import cn.kn.triage.sys.service.LogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

/**
 * @author yinzn
 * @create 2020-10-15 16:49
 */
@Service

public class LogServiceImpl extends BaseService implements LogService {

    private final LogMapper logMapper;

    public LogServiceImpl(LogMapper logMapper) {
        this.logMapper = logMapper;
    }


    @Override
    public R findAll() {
        LogExample logExample = new LogExample();
        /*logExample.setOrderByClause("id desc");  排序*/
        logExample.createCriteria()
                .andUsernameLike("%A%")
                .andOperationLike("%角%");
        PageHelper.startPage(1,5);
        PageInfo<Log> info = new PageInfo<>(logMapper.selectByExample(logExample));
        return R.ok(info);
    }
}
